import os 

# 获取当前目录
cur_dir_path=os.getcwd()
cur_dir_name=cur_dir_path.split('\\')[-1]
for root,_,files in os.walk(cur_dir_path):
    for file1 in files:
        files_hou_zui=os.path.splitext(file1)[-1]
        if files_hou_zui==".mp4":
            os.rename(root+'\\'+file1,root+'\\'+cur_dir_name+'.mp4')
        else:
            pass